﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EITSurferInfinityLib.DataProcessing
{
    public static class FilterAmplitude
    {
        public static double LowPassAmplitude(double frequency, double frequencyCut)
        {
            double w=2*Math.PI*frequency;
            double wc=2*Math.PI*frequencyCut;
            double wwc2=(w/wc)*(w/wc);
            return Math.Sqrt(1 + wwc2) / (1 + wwc2);
        }

        public static double LowPassAmplitude(double frequency, double R, double C)
        {
            double w = 2 * Math.PI * frequency;
            double wcr = w*C*R;
            double wcr2 = wcr*wcr;
            return Math.Sqrt(1 + wcr2) / (1 + wcr2);
        }

        public static double HighPassAmplitude(double frequency, double R, double C)
        {
            double w = 2 * Math.PI * frequency;
            double wcr = w * C * R;
            double wcr2 = wcr * wcr;
            return Math.Sqrt(wcr2 * wcr2 + wcr2) / (1 + wcr2);
        }

        public static double HighPassAmplitude(double frequency, double frequencyCut)
        {
            double w = 2 * Math.PI * frequency;
            double wc = 2 * Math.PI * frequencyCut;
            double wwc2 = (w / wc) * (w / wc);
            double wwc4 = (w / wc) * (w / wc) * (w / wc) * (w / wc);
            return Math.Sqrt(wwc2+wwc4) / (1 + wwc2);
        }
    }
}
